package com.nl.controller.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.nl.controller.web.service.CRMInterfaceService;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@RequestMapping("crmInterface")
public class CRMInterfaceController {

	@Autowired
	private CRMInterfaceService cRMFindMgrService;

	@ApiOperation(value = "项目信息查询", notes = "项目信息查询")
	@PostMapping("queryMgrName")
	private Map<String, Object> findMgrName(
			@RequestParam(value = "cRMReqMgrList", required = true) String cRMReqMgrList/*,HttpServletRequest request*/) {
		/*InputStream in;
		 String reqJson="";
		try {
			in = request.getInputStream();
			reqJson = IOUtils.toString(in, "utf-8");
			log.info("cRMReqMgrList:"+reqJson);
		} catch (IOException e) {
			e.printStackTrace();
			log.error(e.toString());
		}*/
		Map<String, Object> map = cRMFindMgrService.selectMgrNameLike(cRMReqMgrList/*reqJson*/);
		log.info("【CRM项目信息查询接口】返回数据：{}", map);
		return map;
	}
	
    @ApiOperation(value = "开户信息同步", notes = "开户信息同步")
    @PostMapping("synInfo")
    public Map<String, Object> addUser(
            @RequestParam(value = "cRMOpenInfo") String cRMOpenInfo /*,HttpServletRequest request*/        
    ) {
    	/*InputStream in;
		 String reqJson="";
		try {
			in = request.getInputStream();
			reqJson = IOUtils.toString(in, "utf-8");
			log.info("cRMOpenInfo:"+reqJson);
		} catch (IOException e) {
			e.printStackTrace();
			log.error(e.toString());
		}*/
    	 Map<String, Object> map= cRMFindMgrService.addOpenInfo(cRMOpenInfo/*reqJson*/);
    	 log.info("【CRM开户信息同步】返回数据：{}", map);
    	 return map;
    }
    
    @ApiOperation(value = "精准政务开户信息同步测试", notes = "开户信息同步")
    @PostMapping("JZZWOpenTest")
    public Map<String, Object> JZZW(
            @RequestParam(value = "cRMOpenInfo") String cRMOpenInfo  /*,HttpServletRequest request*/        
    ) {
    	/*InputStream in;
		 String reqJson="";
		try {
			in = request.getInputStream();
			reqJson = IOUtils.toString(in, "utf-8");
			log.info("cRMOpenInfo:"+reqJson);
		} catch (IOException e) {
			e.printStackTrace();
			log.error(e.toString());
		}*/
    	 Map<String, Object> map= cRMFindMgrService.JZZW(cRMOpenInfo);
    	 log.info("【精准政务开户信息同步测试】返回数据：{}", map);
    	 return map;
    }


}
